package com.lin.springcloud.service;

import com.lin.springcloud.pojo.Dept;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.List;

/**
 * @ author:lin tingfeng
 * @ data:2021/10/10-21:02
 */
//@FeignClient(value = "SPRINGCLOUD-PROVIDER-DEPT") //服务名
@Component
@FeignClient(value = "SPRINGCLOUD-PROVIDER-DEPT",fallbackFactory = DeptServiceFallBackFactory.class) //开启服务降级并指定返回工厂类
public interface DeptService {
    @PostMapping("/dept/add")
    boolean addDept(Dept dept);

    @GetMapping("/dept/get/{id}")
    Dept queryDeptById(@PathVariable("id") Long id);

    @GetMapping("/dept/list")
    List<Dept> queryDeptAll();
}
